/////////////////////////////////////////////////////////////////////////////
//
//  Fifteen Puzzle
//  Kolonitsky Developers Alliance (c) 2012
//  All rights received
//
/////////////////////////////////////////////////////////////////////////////

package
{

    import controller.StartUpCommand;

    import controller.game.CreateGameCommand;
    import controller.game.MenuGameCommand;
    import controller.game.MoveCommand;
    import controller.game.ResultGameCommand;
    import controller.game.StartGameCommand;

    import org.puremvc.as3.patterns.facade.Facade;

    import view.Game;

    public class AppFacade extends Facade
    {
        public static const STARTUP:String = "startup";
        public static const MENU_GAME:String = "menuGame";
        public static const CREATE_GAME:String = "createGame";
        public static const PLAY_GAME:String = "exitGame";
        public static const MOVE:String = "move";
        public static const GAME_RESULT:String = "gameResult";


        public static function getInstance():AppFacade
        {
            if (instance == null)
                instance = new AppFacade();
            return instance as AppFacade;
        }

        public function startup(game:Game):void
        {
            sendNotification(STARTUP, game)
        }




        //-------------------------------------------------------------------
        //
        //  Override Facade Methods
        //
        //-------------------------------------------------------------------

        override protected function initializeController():void
        {
            super.initializeController();
            registerCommand(STARTUP, StartUpCommand);
            registerCommand(MENU_GAME, MenuGameCommand);
            registerCommand(CREATE_GAME, CreateGameCommand);
            registerCommand(PLAY_GAME, StartGameCommand);
            registerCommand(GAME_RESULT, ResultGameCommand);
            registerCommand(MOVE, MoveCommand);
        }
    }
}
